package com.af.system.multithreading;

/**
 * @author : zhenyun.su
 * @comment : 线程池处理结果
 * @since : 2020/2/26
 */

public class AfMultithreadingResult<T> {
    private Boolean status;
    private Integer code;
    private String info;


    public void setResult(Boolean status, Integer code, String info){
        this.code=code;
        this.info=info;
        this.status=status;
    }

    public void process(String info){
        this.setResult(false, 0 ,info);
    }

    public void success(String info){
        this.setResult(true, 1 ,info);
    }

    public void failure(String info){
        this.setResult(false, -2 ,info);
    }

    public void exception(String info){
        this.setResult(false, -1 ,info);
    }

    public void finish(String info){
        this.setInfo(this.getInfo()+"; "+info);
//        this.setResult(true, 2 ,info);
    }

    public Boolean getStatus() {
        return status;
    }

    public void setStatus(Boolean status) {
        this.status = status;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    @Override
    public String toString() {
        return "MultithreadingResult{" +
                "status=" + status +
                ", code='" + code + '\'' +
                ", info='" + info + '\'' +
                '}';
    }
}
